* Project      :  The Full, Persistent, and Symmetric Pass-Through of a Temporary VAT Cut
* Authors      :  Márcia Silva-Pereira, João Quelhas, Tiago Bernardino, Ricardo Duque Gabriel
* Date         :  01/04/2025
* Description  :  Event-study Regression - Daily Data
* Dependencies :
* Modifications: (add date, author and change)

*********************************************************
*                Event-study Regression                 *
*********************************************************

local vce_cluster ${vce_cluster}
local weights ${weights}
local variable ${variable}
local aggregation ${aggregation}

local window 5
local trend -5
	
// Load the cleaned dataset.
use "${path_work}/auxiliar/imputation_0_only_food.dta", clear

*********************************************************

* FIGURE A.5: Pass-Through Estimates of the 2023 Temporary VAT Cut in Portugal (B) Daily Data
*********************************************************

preserve

// Keep the data around the event.
keep if date >= td(12/04/2023)
keep if date <= td(24/04/2023)

// Policy variable: 1 after the reference date.
replace treatment = 0 if date < mdy(04,18,2023)

if ${weights} == 0 {

// Run the event-study regression.
xtevent index_23032023, policyvar(treatment) panelvar(id_sm) timevar(date) window(`window') vce(cluster ${vce_cluster}) impute(nuchange) reghdfe trend(`trend', method(gmm) saveoverlay)
	
}

if ${weights} == 1 {

// Run the event-study regression.
xtevent index_23032023 [pweight = weight], policyvar(treatment) panelvar(id_sm) timevar(date) window(`window') vce(cluster ${vce_cluster}) impute(nuchange) reghdfe trend(`trend', method(gmm) saveoverlay)
		
}

// Make the plot with the results.
xteventplot, ytitle("Percentage change") xtitle("Days to event") ///
	nosupt scatterplotopts(lcolor(dknavy) recast(connected) mcolor(dknavy) ///
	msymbol(circle)) ciplotopts(recast(rarea) mcolor(black) fcolor(dknavy*0.2)) ///
	graphregion(fcolor(white)) yscale(lcolor(black) lwidth(none) line) ///
	tscale(lcolor(black) lwidth(none) line) ylabel(-8(2)2) ///
	yline(-5.66, lcolor("dknavy") lpattern(dash) lwidth(medthin)) ///
	text(-6.1 -5.8 "100% Pass-Through", color("dknavy") placement(e)) ///
	xline(0, lcolor("gray*0.5") lpattern(solid) lwidth(medthin)) ///
	text(1.8 0.1 "Implementation", color("gray") placement(e))
	
// Export the graph.
graph export "${results_figures}/figure_a5b.png", as(png) replace width(2400) height(1372)

restore

*********************************************************


* FIGURE A.7: Pass-Through Estimates of the 2023 Temporary VAT Cut Reversion in Portugal (B) Daily Data
*********************************************************

preserve

// Keep the data around the event.
keep if date >= td(28/12/2023)
keep if date <= td(12/01/2024)

// Policy variable: 1 after the reference date.
replace treatment = 0 if date < mdy(01,05,2024)

if ${weights} == 0 {
	
// Run the event-study regression.
xtevent index_23032023, policyvar(treatment) panelvar(id_sm) timevar(date) window(`window') vce(cluster ${vce_cluster}) impute(nuchange) reghdfe trend(`trend', method(gmm) saveoverlay)
	
}

if ${weights} == 1 {

// Run the event-study regression.
xtevent index_23032023 [pweight = weight], policyvar(treatment) panelvar(id_sm) timevar(date) window(`window') vce(cluster ${vce_cluster}) impute(nuchange) reghdfe trend(`trend', method(gmm) saveoverlay)
		
}

// Make the plot with the results.
xteventplot, ytitle("Percentage change") xtitle("Days to event") ///
	nosupt scatterplotopts(lcolor(dknavy) recast(connected) mcolor(dknavy) ///
	msymbol(circle)) ciplotopts(recast(rarea) mcolor(black) fcolor(dknavy*0.2)) ///
	graphregion(fcolor(white)) yscale(lcolor(black) lwidth(none) line) ///
	tscale(lcolor(black) lwidth(none) line) ylabel(-2(2)8) ///
	yline(6, lcolor("dknavy") lpattern(dash) lwidth(medthin)) ///
	text(6.3 -5.8 "100% Pass-Through", color("dknavy") placement(e)) ///
	xline(0, lcolor("gray*0.5") lpattern(solid) lwidth(medthin)) ///
	text(-1.8 0.1 "Reversal", color("gray") placement(e))
	
// Export the graph.
graph export "${results_figures}/figure_a7b.png", as(png) replace width(2400) height(1372)

restore

********************************************************************************
